//
//  MyTableViewCell.m
//  FVQuickMessage
//
//  Created by dllo on 16/8/10.
//  Copyright © 2016年 zty. All rights reserved.
//

#import "MyTableViewCell.h"

@interface MyTableViewCell ()

@property (nonatomic, retain) UIImageView *topImageView;
@property (nonatomic, retain) UILabel *nameLabel;

@end

@implementation MyTableViewCell


-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        
        self.topImageView = [[UIImageView alloc] init];
        [self.contentView addSubview:_topImageView];
        
        self.nameLabel = [[UILabel alloc] init];
        [self.contentView addSubview:_nameLabel];
        
        [self config];
    }
    return self;
}

-(void)config {
    
   [self.topImageView mas_makeConstraints:^(MASConstraintMaker *make) {
      
       make.top.equalTo(self.contentView).with.offset(10);
       make.left.equalTo(self.contentView).with.offset(10);
       make.width.offset(40);
       make.height.offset(40);
       
   }];
    
    [self.nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
       
        make.top.equalTo(self.contentView).with.offset(10);
        make.left.equalTo(self.topImageView).with.offset(50);
        make.width.offset(WIDTH - 40);
        make.height.offset(40);
        
    }];
    
}

-(void)setName:(NSString *)name {
    
    _name = name;
    
    self.topImageView.image = [UIImage imageNamed:name];
    
    self.nameLabel.text = name;
    
}

@end
